package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.ShopClientFeigntImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.shop.dos.ShopDO;
import com.enation.app.javashop.model.shop.dto.ShopBankDTO;
import com.enation.app.javashop.model.shop.vo.ShopVO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 *店铺相关熔断 fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:27
 **/
@Component
public class ShopClientFallbackFactory extends BaseFallbackFactory<ShopClientFeigntImpl> {
    @Override
    protected ShopClientFeigntImpl fallback() {
        return new ShopClientFallback();
    }

    /**
     * 店铺相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午4:36
     * @since v7.0
     */
    @Component
    public static class ShopClientFallback implements ShopClientFeigntImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public ShopVO getShop(Long shopId) {
            logger.error("获取店铺ID为" + shopId + "的店铺信息错误");
            return null;
        }

        @Override
        public List<ShopBankDTO> listShopBankInfo() {
            logger.error("获取所有店铺的银行信息错误");
            return null;
        }

        @Override
        public void addCollectNum(Long shopId) {
            logger.error("增加店铺ID为" + shopId + "店铺的收藏数量");
        }

        @Override
        public void reduceCollectNum(Long shopId) {
            logger.error("减少店铺ID为" + shopId + "店铺的收藏数量");
        }

        @Override
        public void calculateShopScore() {
            logger.error("计算店铺评分错误");
        }

        @Override
        public void updateShopGoodsNum(Long sellerId, Integer sellerGoodsCount) {
            logger.error("更新店铺ID为" + sellerId + "店铺的商品数量");
        }

        @Override
        public int queryShopCount() {
            logger.error("queryShopCountyi异常");
            return 0;
        }

        @Override
        public List<ShopDO> queryShopByRange(Long i, Long pageSize) {
            logger.error("queryShopByRange异常");
            return null;
        }


    }
}
